import os
import random
 
 
def main(image_dir):
	save_image_txt = './pic_path.txt'
	save_val_number = 0
 
	img_path_list = []
 
	image_list = os.listdir(image_dir)
	for i in image_list:
		#if os.path.isdir(image_dir):
		#print("i:", i)
		image_path = image_dir + '/' + i
		#print("image_path:", image_path)
		img_path_list.append(image_path)
 
	#print(img_path_list)
 
	
	print('len of all', len(img_path_list))
 
	random.shuffle(img_path_list)
 
	with open(save_image_txt, 'w') as F:
		for i in range(len(img_path_list)):
		    F.write(img_path_list[i]+'\n')
 
 
if __name__ == '__main__':
    image_dir = 'img/images'  # 图片所在路径，大概500张
    main(image_dir)
